# liquids and bombs
import pygame

class Liquid(pygame.sprite.Sprite):
    def __init__(self,pos,speed,screen_height):
        super().__init__()
        file_path = '../graphics/liquid.png'
        self.image = pygame.image.load(file_path).convert_alpha()
        self.rect = self.image.get_rect(center = pos)
        self.speed = speed
        self.height_y_constraint = screen_height

    # kill the liquid when outside the screen
    def destroy(self):
        if self.rect.y <= -50 or self.rect.y >= self.height_y_constraint +50:
            self.kill()
    
    def update(self):
        self.rect.y += self.speed
        self.destroy()

class Bomb(pygame.sprite.Sprite):
    def __init__(self,pos,speed,screen_height):
        super().__init__()
        file_path = '../graphics/bomb.png'
        self.image = pygame.image.load(file_path).convert_alpha()
        self.rect = self.image.get_rect(center = pos)
        self.speed = speed
        self.height_y_constraint = screen_height

    # kill the bomb when outside the screen
    def destroy(self):
        if self.rect.y <= -50 or self.rect.y >= self.height_y_constraint +50:
            self.kill()
    
    def update(self):
        self.rect.y += self.speed
        self.destroy()